﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScriptEditor.Commands
{
    class Command_ChangeFace : Command
    {
        public string charName
        {
            get
            {
                return Value1;
            }
            set
            {
                Value1 = value;
            }
        }
        public float eye
        {
            get
            {
                string[] strs = Value2.Split(new char[] { '|' });
                return float.Parse(strs[0]);
            }
            set
            {
                string[] strs = Value2.Split(new char[] { '|' });
                Value2 = value.ToString() + "|" + strs[1] + "|" + strs[2];
            }
        }
        public float eyebrow
        {
            get
            {
                string[] strs = Value2.Split(new char[] { '|' });
                return float.Parse(strs[1]);
            }
            set
            {
                string[] strs = Value2.Split(new char[] { '|' });
                Value2 = strs[0] + "|" + value.ToString() + "|" + strs[2];
            }
        }
        public float mouth
        {
            get
            {
                string[] strs = Value2.Split(new char[] { '|' });
                return float.Parse(strs[2]);
            }
            set
            {
                string[] strs = Value2.Split(new char[] { '|' });
                Value2 = strs[0] + "|" + strs[1] + "|" + value.ToString();
            }
        }
        public Command_ChangeFace()
        {
            CommandType = COMMANDTYPE.ChangeFace;
            charName = "请输入角色名";
            Value2 = "0|0|0";   //初始化避免对未实例化对象赋值
        }
        public Command_ChangeFace(string CharName, float Eye, float Eyebrow, float Mouth)
        {
            CommandType = COMMANDTYPE.ChangeFace;
            charName = CharName;
            Value2 = "0|0|0";   //初始化避免对未实例化对象赋值
            eye = Eye;
            eyebrow = Eyebrow;
            mouth = Mouth;
        }
        public override string ToString()
        {
            return CommandType.ToString() + ":\n" + "改变角色表情:" + charName;
        }
    }
}
